package org.sixtynine.stock.service.impl;

import java.util.Date;
import java.util.List;

import org.sixtynine.stock.dao.MonthlyShareDataDao;
import org.sixtynine.stock.dto.GridPramDTO;
import org.sixtynine.stock.dto.Page;
import org.sixtynine.stock.entity.MonthlyShareData;
import org.sixtynine.stock.service.MonthlyShareDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Thilan
 * 
 */
@Service
public class MonthlyShareDataServiceImpl implements MonthlyShareDataService {

	@Autowired
	private MonthlyShareDataDao monthlyShareDataDao;

	@Override
	public MonthlyShareData findById(int id) {
		return monthlyShareDataDao.findById(id);
	}

	@Override
	public void saveMonthlyShareData(MonthlyShareData monthlyShareData) {
		monthlyShareDataDao.saveMonthlyShareData(monthlyShareData);
	}

	@Override
	public void deleteMonthlyShareData(int id) {
		MonthlyShareData monthlyShareData = monthlyShareDataDao.findById(id);
		if (monthlyShareData != null) {
			monthlyShareDataDao.delete(monthlyShareData);
		}
	}

	@Override
	public List<MonthlyShareData> findMonthlyShareData(int id) {
		return monthlyShareDataDao.findMonthlyShareData(id);
	}

	@Override
	public List<MonthlyShareData> searchMonthlyShareData(int companyId,
			Date fromDate, Date toDate, String orderBy, String orderByName) {
		return monthlyShareDataDao.searchMonthlyShareData(companyId, fromDate,
				toDate, orderBy, orderByName);
	}

	@Override
	public Page<MonthlyShareData> searchMonthlyShareData(int companyId,
			Date fromDate, Date toDate, String orderBy, String orderByName,
			GridPramDTO gridPramDTO) {
		return monthlyShareDataDao.searchMonthlyShareData(companyId, fromDate,
				toDate, orderBy, orderByName, gridPramDTO);
	}

	@Override
	public void deleteMonthlyShareData(int companyId, Date fromDate, Date toDate) {
		monthlyShareDataDao.deleteMonthlyShareData(companyId, fromDate, toDate);
	}

}
